package com.vito.dcs.sys.constructionVehicle.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.vito.base.factory.IDFactory;
import com.vito.base.model.DataGrid;
import com.vito.dcs.sys.constructionVehicle.dao.SysConstructionVehicleMapper;
import com.vito.dcs.sys.constructionVehicle.model.SysConstructionVehicleModel;
import com.vito.dcs.sys.constructionVehicle.service.SysConstructionVehicleService;

/**
 * SysConstructionVehicleService接口实现类
 * @author  Feng J. E-mail: 
 * @version 0.1.1
 * @date    2019-3-28 14:15:43
 */
@Service
public class SysConstructionVehicleServiceImpl implements SysConstructionVehicleService {
	
	@Autowired
	private SysConstructionVehicleMapper sysconstructionvehicleMapper;
	
	@Override
	public void saveSysConstructionVehicle(SysConstructionVehicleModel sysconstructionvehicle){
		  sysconstructionvehicle.setId(IDFactory.getIDFactory().getIdInc()+"");
		  SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
		  sysconstructionvehicle.setUpdateTime(df.format(new Date()));
		  sysconstructionvehicleMapper.saveSysConstructionVehicle(sysconstructionvehicle);
	}
	@Override
	public DataGrid<SysConstructionVehicleModel> querySysConstructionVehicleByPage(SysConstructionVehicleModel sysconstructionvehicle){
		DataGrid<SysConstructionVehicleModel> dg = new DataGrid<SysConstructionVehicleModel>();
		dg.setRows(sysconstructionvehicleMapper.querySysConstructionVehicleByPage(sysconstructionvehicle));
		dg.setTotal(sysconstructionvehicle.getTotal());
		return dg;
	}
	@Override
	public SysConstructionVehicleModel querySysConstructionVehicle(SysConstructionVehicleModel sysconstructionvehicle){
		return sysconstructionvehicleMapper.querySysConstructionVehicle(sysconstructionvehicle);
	}
	@Override
	public SysConstructionVehicleModel updateSysConstructionVehicle(SysConstructionVehicleModel sysconstructionvehicle){
		if(sysconstructionvehicleMapper.updateSysConstructionVehicle(sysconstructionvehicle)>0){
			return sysconstructionvehicle;
		}else{
			return null;
		}
	}
	
	@Override
	public Integer deleteSysConstructionVehicle(SysConstructionVehicleModel sysconstructionvehicle){
		return sysconstructionvehicleMapper.deleteSysConstructionVehicle(sysconstructionvehicle);
	}
	@Override
	public SysConstructionVehicleModel querySysConstructionVehicle2(
			SysConstructionVehicleModel sysconstructionvehicle) {
		return sysconstructionvehicleMapper.querySysConstructionVehicle2(sysconstructionvehicle);
	}
	@Override
	public Integer queryIsValidateMac(
			SysConstructionVehicleModel sysconstructionvehicle) {
		return sysconstructionvehicleMapper.queryIsValidateMac(sysconstructionvehicle);
	}

}